package cn.wolfcode.rbac.domain;

import com.alibaba.fastjson.JSON;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Getter
@Setter
public class Customer {
    public static final int STATUS_COMMON=0;//潜在用户
    public static final int STATUS_POOL=1;//客户池
    public static final int STATUS_NORMAL=2;//正式用户
    public static final int STATUS_FAIL=3;//开发失败
    public static final int STATUS_LOST=4;//流失用户
    private Long id;
    private String name;
    private Integer age;
    private Integer gender=1;
    private String tel;
    private String qq;
    private SystemDictionaryItem job;
    private SystemDictionaryItem source;
    private Employee seller;
    private Employee inputuser;
    private Date inputTime;
    private Integer status=STATUS_COMMON;
    public String getStatusName(){
        switch(status){
            case STATUS_POOL:return "客户池";
            case STATUS_NORMAL:return "正式用户";
            case STATUS_FAIL:return "开发失败";
            case STATUS_LOST:return "流失用户";
        }
        return "潜在用户";
    }
    public String getGenderName(){
        switch(gender){
            case 0:return "女";
        }
        return "男";
    }
    public String getJson(){
        Map<String,Object> map=new HashMap<>();
        map.put("id",id);
        map.put("name",name);
        map.put("age",age);
        map.put("gender",gender);
        map.put("tel",tel);
        map.put("qq",qq);
        map.put("jobId",job.getId());
        map.put("sourceId",source.getId());
        map.put("sellerId",seller.getId());
        map.put("sellerName",seller.getName());
        map.put("status",status);
        return JSON.toJSONString(map);
    }
}